from args import *
from elasticsearch import Elasticsearch, helpers
import math
client = Elasticsearch(
            hosts=ELASTIC_ADDRESS, basic_auth=(ELASTIC_USERNAME, ELASTIC_PASSWORD),
            timeout=10000)

def create_index():
    result = client.indices.create(index=WRITE_NAME, body=index_new
                                   , ignore=400)
    if result.get("acknowledged"):
        print("索引创建成功")
    else:
        print("索引创建失败")
        print(result)


if __name__ == "__main__":
    create_index()